//
//  main.cpp
//  对象成员的应用
//
//  Created by mac on 16/3/21.
//  Copyright © 2016年 mac. All rights reserved.
//

#include <iostream>
using namespace std;
class Score{
private:
    int Math;
    int English;
    int Chinese;
public:
    Score(int m,int e,int c);
    void show(){
        cout<<"Math:"<<Math<<endl;
        cout<<"English:"<<English<<endl;
        cout<<"Chinese:"<<Chinese<<endl;
    }
    ~Score(){};
};
Score::Score(int m,int e,int c):Math(m),English(e),Chinese(c){}
class Student{
private:
    int age;
    int no;
    char *name;
    Score score;
public:
    Student(char *str,int agei,int noi,int math,int english,int chinese);
    ~Student(){
        if (name!=NULL) {
            delete name;
        }
    }
    void disp(){
        cout<<"Name:"<<name<<endl;
        cout<<"No:"<<no<<endl;
        cout<<"Age:"<<age<<endl;
        cout<<"Score"<<endl;
        score.show();
    }
};
Student::Student(char *str,int agei,int noi,int math,int english,int chinese):score(math,english,chinese){
    name=new char[strlen(str)+1];
    strcpy(name, str);
    age=agei;
    no=noi;
    
}
int main(int argc, const char * argv[]) {
    // insert code here...
    std::cout << "Hello, World!\n";
    Student stu1("Tom",18,1403,88,92,71);
    stu1.disp();
    return 0;
}
